#lang racket


(require "../math.rkt"
         "../point.rkt")

(require "domain.rkt"
         "parametric-curve.rkt")


(provide make-circumference
         circumference-radius)


(define-struct (circumference parametric-curve)
  (radius)
  #:constructor-name new-circumference)

(define (circumference-object radius)
  (λ (t)
    (sph radius t pi/2)))

(define (circumference-tangent radius)
  (λ (t)
    (xyz (- (sin t)) (cos t) 0)))

(define (circumference-normal radius)
  (λ (t)
    (xyz (- (cos t)) (- (sin t)) 0)))

(define (circumference-binormal radius)
  (λ (t)
    (xyz 0 0 1)))

(define (make-circumference transformation radius)
  (new-circumference
   (make-domain 'closed 0 'open 2pi)
   (circumference-object radius)
   (circumference-tangent radius)
   (circumference-normal radius)
   (circumference-binormal radius)
   transformation
   radius))